home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
tools
/
czesc_2
/
ispell-3.3ljr
/
ispell
/
hash.c
< prev
next >
Wrap
Text File
|
1990-08-05
|
311b
|
26 lines
/*
* hash.c - a simple hash function for ispell
*
* Pace Willisson, 1983
*/
unsigned int hash (char *s, int n, int hashsize)
{
short h = 0;
while (n--)
{
h ^= *s++;
if (h < 0)
{
h <<= 1;
h++;
}
else
h <<= 1;
}
h &= 077777;
return (unsigned int) h % hashsize;
}